package org.shangrila.app;

import org.shangrila.comm.dao.DbAccess;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication(scanBasePackages = {"org.shangrila"}) //指定扫描org.shangrila包下的所有bean
@EnableScheduling //微信token定时更新任务
public class MainApplication{

	public static void main(String[] args) {
		SpringApplication.run(MainApplication.class, args);
	}
	
	//配置DB访问Bean，在应用中通过注入方式使用DbAccess实例 
	@Bean
	public DbAccess dbAccess() {
		  DbAccess dbAccess = new DbAccess();
	   return dbAccess;
	}
	
}

/*
//war版：更换pom.xml为pom-war.xml和主类即可
//jar版：更换pom.xml为pom-jar.xml和主类即可

import org.shangrila.comm.dao.DbAccess;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;

public class MainApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {
		SpringApplication.run(MainApplication.class, args);
	}

	//打包war时需要配置的 Main类需要 extends SpringBootServletInitializer
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(MainApplication.class);
	}

//配置DB访问Bean，在应用中通过注入方式使用DbAccess实例 
@Bean
public DbAccess dbAccess() {
	  DbAccess dbAccess = new DbAccess();
   return dbAccess;
}
*/
